import { configureStore } from "@reduxjs/toolkit";
import loginReducer from "../store/modules/login";
import patientReducer from "../store/modules/patient";
import leaveWordReducer from "../store/modules/leaveWord";
import articleReducer from "../store/modules/article";
import videoRedducer from "../store/modules/video";
import programmeReducer from "@/store/modules/programme";
import {
  type TypedUseSelectorHook,
  useDispatch,
  useSelector,
} from "react-redux";

const store = configureStore({
  reducer: {
    login: loginReducer,
    patient: patientReducer,
    leaveWord: leaveWordReducer,
    article: articleReducer,
    video: videoRedducer,
    programme: programmeReducer,
  },
});
type GetStateFnType = typeof store.getState;
type IRootState = ReturnType<GetStateFnType>;
export const useAppSelector: TypedUseSelectorHook<IRootState> = useSelector;

type DispatchType = typeof store.dispatch;
export const useAppDispatch: () => DispatchType = useDispatch;
export default store;
